import requ from '@/utils/request';

//七牛文件上传
export function qiniuUpload(data) {
    return requ.post('http://up-z2.qiniup.com/',data )
        .then(function (response) {
            return response.data
        })
}
//获取上传Token
export function getQiniuUploadToken_() {
    return requ.get('/rpc/get_upload_token/' )
        .then(function (response) {
            return response.data
        })
}
//获取已处理未查看的订单数量
export function getUncheckedCount(params) {
    return requ.get('/rpc/get_unchecked_count/', {params})
        .then(function (response) {
            return response.data
        })
}
//申请加急
export function urgentworkorder(id) {
    return requ.put(`/rpc/work_order/urgent/${id}/`)
        .then(function (response) {
            return response.data
        })
}
//删除反馈记录
export function deleteworkorder(id) {
    return requ.delete(`/rpc/work_order/${id}/`)
        .then(function (response) {
            return response.data
        })
}
//评价一条工单
export function setcommnet(data,id) {
    return requ.put(`/rpc/work_order/${id}/`, data)
        .then(function (response) {
            return response.data
        })
}
//查看一条工单详情
export function getworkorderdetail(id) {
    return requ.get(`/rpc/work_order/${id}/`)
        .then(function (response) {
            return response.data
        })
}
//获取公告
export function announcementAlert(params) {
    return requ.get(`/rpc/announcement/`, {params})
        .then(function (response) {
            return response.data
        })
}
//获取工单记录
export function getworkorderlist(params) {
    return requ.get(`/rpc/work_order/?t=` + new Date().getTime(), {params})
        .then(function (response) {
            return response.data
        })
}
export function getProblemType(params) {
  return requ.get('/rpc/problem_type/', {params})
      .then(function (response) {
        return response.data
      })
}
export function getCommonProblem(params) {
    return requ.get('/rpc/common_problem/', {params})
        .then(function (response) {
            return response.data
        })
}

export function submitWorkOrder(data) {
    return requ.post('/rpc/work_order/', data)
    .then(function (response) {
      return response.data
    })
}

export function submitappeal(data) {
    return requ.post('/rpc/appeal/', data)
        .then(function (response) {
            return response.data
        })
}
export function getappeal(params) {
    return requ.get('/rpc/appeal/', {params})
        .then(function (response) {
            return response.data
        })
}

export function getInfo(params) {
    return requ.get('/rpc/get_recent_orders/',  {params})
        .then(function (response) {
            return response.data
        })
}

